from py2neo import Graph
from src.config import app_config


class Neo4jInstance:
    _instance = None

    @classmethod
    def get_connect(cls):
        if cls._instance is None:
            cls._instance = Graph(app_config.NEO4J_URL, auth=(app_config.USERNAME, app_config.PASSWORD))
        return cls._instance

    def __init__(self):
        if Neo4jInstance._instance is not None:
            raise Exception("This class is a singleton!")
        self.value = None
